/**
 * ConsoleLog.java
 * @author: liuex
 * 2008-1-1 ����01:23:24
 *
 * note: 
 */
package org.lex.net.log;

public class ConsoleLog extends StreamLog {
	private static final ConsoleLog instance = new ConsoleLog();

	public static ConsoleLog getInstance() {
		return instance;
	}

	public ConsoleLog() {
		super(System.out);
	}

	protected String format(Type type, Object source, Object message) {
		StringBuilder buf = new StringBuilder();
		buf.append('[').append(format(type)).append("]\t");
		buf.append(message);
		return buf.toString();
	}

	private static final String[] TYPES_NAMES = { "send", "recv", "erro", "misc" };

	protected String format(Type type) {
		return TYPES_NAMES[type.ordinal()];
	}
}
